<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        var xhr = new XMLHttpRequest();
        xhr.open('get','json.php',true);
        xhr.send(null);
        xhr.onreadystatechange = function(){
            if(this.readyState == 4){
                var j = this.responseText;
                console.log(JSON.parse(j));
            }
        }
    </script>
</body>
</html>